import express, {Express, Router, Request, Response} from 'express'
import axios from 'axios';

const app:Express = express()

const port = '8089'

app.use('*', (req, res, next) => {
    res.header('Access-Control-Allow-Origin', '*')

    next()
})

const router:Router = express.Router() // 模块去分

app.use('/api', router)

router.get('/static', async (req:Request, res:Response) => {
    const resDetail = await axios.get('https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail')
    const result = await axios.get('https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5&_t=0.5175023969769719&callback=__jpcb0')
    const __jpcb0 = (item:any) => {
        res.json({
            ...JSON.parse(item.data),
            ...resDetail.data.data
        })
    }
    eval(result.data)
    
})

app.listen(port, () => {
    console.log(`success server http://localhost:${port}`)
})